home *** CD-ROM | disk | FTP | other *** search
/ Turnbull China Bikeride / Turnbull China Bikeride - Disc 2.iso / STUTTGART / PROBLEMS / BENCHMARK / BUBBLESORT / bubbletest / func_asm < prev    next >
Text File  |  1992-05-16  |  7KB  |  216 lines

  1. ; pipeout of formula (formula is Freeware)
  2.  
  3.  ; FUNCTION INT field(INT fieldnr,CHARPTR target,CHARPTR source)
  4.   .MACRO field formularesult,fieldnr,target,source
  5.      ; INT sourcei     
  6.      ; INT targeti     
  7.      ; INT fieldcount
  8.      ; INT readyflag
  9.  
  10.      ; LET readyflag=0;
  11.       saveregister
  12.        ;[stackregister,#28.]=0.
  13.       INTconstload R0,0.
  14.       INTstackstore [stackregister,#28.],R0
  15.      ; LET target[0]=0;
  16.        ;0.
  17.       ; array [stackregister,#%3] with 1 dimensions
  18.       INTconstload R1,0.
  19.       INTconstmult R1,1
  20.       CHARPTRstackload R2,[stackregister,#%3]
  21.       CHARPTR2INT R2,R2
  22.       INTsum R1,R1,R2
  23.        ;R1=0.
  24.       INTconstload R0,0.
  25.       INT2CHAR R0,R0
  26.       CHARarraystore R1,R0
  27.      ; LET sourcei=0;
  28.        ;[stackregister,#16.]=0.
  29.       INTconstload R0,0.
  30.       INTstackstore [stackregister,#16.],R0
  31.      ; LET targeti=0;
  32.        ;[stackregister,#20.]=0.
  33.       INTconstload R0,0.
  34.       INTstackstore [stackregister,#20.],R0
  35.      ; LET fieldcount=1
  36.        ;[stackregister,#24.]=1.
  37.       INTconstload R0,1.
  38.       INTstackstore [stackregister,#24.],R0
  39.      ; WHILE ! readyflag
  40. \whilelabel1
  41.        ;![stackregister,#28.]
  42.       INTstackload R0,[stackregister,#28.]
  43.       INTnot R0,R0
  44.       ifnotgoto \endwhilelabel1,R0
  45.         ; WHILE (source[sourcei]<=32) && (source[sourcei]!=0)
  46. \whilelabel2
  47.           ;[stackregister,#16.]
  48.          ; array [stackregister,#%4] with 1 dimensions
  49.          INTstackload R1,[stackregister,#16.]
  50.          INTconstmult R1,1
  51.          CHARPTRstackload R2,[stackregister,#%4]
  52.          CHARPTR2INT R2,R2
  53.          INTsum R1,R1,R2
  54.          CHARarrayload R1,R1
  55.           ;R1<=32.
  56.          INTconstload R0,32.
  57.          CHAR2INT R1,R1
  58.          INTlessequal R1,R1,R0
  59.           ;[stackregister,#16.]
  60.          ; array [stackregister,#%4] with 1 dimensions
  61.          INTstackload R2,[stackregister,#16.]
  62.          INTconstmult R2,1
  63.          CHARPTRstackload R3,[stackregister,#%4]
  64.          CHARPTR2INT R3,R3
  65.          INTsum R2,R2,R3
  66.          CHARarrayload R2,R2
  67.           ;R2!=0.
  68.          INTconstload R0,0.
  69.          CHAR2INT R2,R2
  70.          INTnotequal R2,R2,R0
  71.           ;R1&&R2
  72.          INTand R1,R1,R2
  73.          ifnotgoto \endwhilelabel2,R1
  74.            ; LET sourcei=sourcei+1;
  75.              ;[stackregister,#16.]=[stackregister,#16.]+1.
  76.             INTstackload R0,[stackregister,#16.]
  77.             INTconstload R1,1.
  78.             INTsum R0,R0,R1
  79.             INTstackstore [stackregister,#16.],R0
  80.         ; ENDWHILE
  81.          goto \whilelabel2
  82. \endwhilelabel2
  83.         ; IF source[sourcei]==0
  84.           ;[stackregister,#16.]
  85.          ; array [stackregister,#%4] with 1 dimensions
  86.          INTstackload R1,[stackregister,#16.]
  87.          INTconstmult R1,1
  88.          CHARPTRstackload R2,[stackregister,#%4]
  89.          CHARPTR2INT R2,R2
  90.          INTsum R1,R1,R2
  91.          CHARarrayload R1,R1
  92.           ;R1==0.
  93.          INTconstload R0,0.
  94.          CHAR2INT R1,R1
  95.          INTequal R1,R1,R0
  96.          ifnotgoto \elselabel3,R1
  97.            ; LET readyflag=1;
  98.              ;[stackregister,#28.]=1.
  99.             INTconstload R0,1.
  100.             INTstackstore [stackregister,#28.],R0
  101.         ; ELSE
  102.          goto \endiflabel3
  103. \elselabel3
  104.            ; WHILE (source[sourcei]!=32) && (source[sourcei]!=0)
  105. \whilelabel4
  106.              ;[stackregister,#16.]
  107.             ; array [stackregister,#%4] with 1 dimensions
  108.             INTstackload R1,[stackregister,#16.]
  109.             INTconstmult R1,1
  110.             CHARPTRstackload R2,[stackregister,#%4]
  111.             CHARPTR2INT R2,R2
  112.             INTsum R1,R1,R2
  113.             CHARarrayload R1,R1
  114.              ;R1!=32.
  115.             INTconstload R0,32.
  116.             CHAR2INT R1,R1
  117.             INTnotequal R1,R1,R0
  118.              ;[stackregister,#16.]
  119.             ; array [stackregister,#%4] with 1 dimensions
  120.             INTstackload R2,[stackregister,#16.]
  121.             INTconstmult R2,1
  122.             CHARPTRstackload R3,[stackregister,#%4]
  123.             CHARPTR2INT R3,R3
  124.             INTsum R2,R2,R3
  125.             CHARarrayload R2,R2
  126.              ;R2!=0.
  127.             INTconstload R0,0.
  128.             CHAR2INT R2,R2
  129.             INTnotequal R2,R2,R0
  130.              ;R1&&R2
  131.             INTand R1,R1,R2
  132.             ifnotgoto \endwhilelabel4,R1
  133.               ; IF fieldcount==fieldnr
  134.                 ;[stackregister,#24.]==[stackregister,#%2]
  135.                INTstackload R0,[stackregister,#24.]
  136.                INTstackload R1,[stackregister,#%2]
  137.                INTequal R0,R0,R1
  138.                ifnotgoto \elselabel5,R0
  139.                  ; LET readyflag=1;
  140.                    ;[stackregister,#28.]=1.
  141.                   INTconstload R0,1.
  142.                   INTstackstore [stackregister,#28.],R0
  143.                  ; LET target[targeti]=source[sourcei];
  144.                    ;[stackregister,#20.]
  145.                   ; array [stackregister,#%3] with 1 dimensions
  146.                   INTstackload R1,[stackregister,#20.]
  147.                   INTconstmult R1,1
  148.                   CHARPTRstackload R2,[stackregister,#%3]
  149.                   CHARPTR2INT R2,R2
  150.                   INTsum R1,R1,R2
  151.                    ;[stackregister,#16.]
  152.                   ; array [stackregister,#%4] with 1 dimensions
  153.                   INTstackload R2,[stackregister,#16.]
  154.                   INTconstmult R2,1
  155.                   CHARPTRstackload R3,[stackregister,#%4]
  156.                   CHARPTR2INT R3,R3
  157.                   INTsum R2,R2,R3
  158.                   CHARarrayload R2,R2
  159.                    ;R1=R2
  160.                   CHARarraystore R1,R2
  161.                  ; LET targeti=targeti+1;
  162.                    ;[stackregister,#20.]=[stackregister,#20.]+1.
  163.                   INTstackload R0,[stackregister,#20.]
  164.                   INTconstload R1,1.
  165.                   INTsum R0,R0,R1
  166.                   INTstackstore [stackregister,#20.],R0
  167.               ; ENDIF     
  168. \elselabel5
  169.               ; LET sourcei=sourcei+1
  170.                 ;[stackregister,#16.]=[stackregister,#16.]+1.
  171.                INTstackload R0,[stackregister,#16.]
  172.                INTconstload R1,1.
  173.                INTsum R0,R0,R1
  174.                INTstackstore [stackregister,#16.],R0
  175.            ; ENDWHILE
  176.             goto \whilelabel4
  177. \endwhilelabel4
  178.            ; IF readyflag
  179.              ;[stackregister,#28.]
  180.             INTstackload R0,[stackregister,#28.]
  181.             ifnotgoto \elselabel6,R0
  182.               ; LET target[targeti]=0
  183.                 ;[stackregister,#20.]
  184.                ; array [stackregister,#%3] with 1 dimensions
  185.                INTstackload R1,[stackregister,#20.]
  186.                INTconstmult R1,1
  187.                CHARPTRstackload R2,[stackregister,#%3]
  188.                CHARPTR2INT R2,R2
  189.                INTsum R1,R1,R2
  190.                 ;R1=0.
  191.                INTconstload R0,0.
  192.                INT2CHAR R0,R0
  193.                CHARarraystore R1,R0
  194.            ; ELSE
  195.             goto \endiflabel6
  196. \elselabel6
  197.               ; LET fieldcount=fieldcount+1
  198.                 ;[stackregister,#24.]=[stackregister,#24.]+1.
  199.                INTstackload R0,[stackregister,#24.]
  200.                INTconstload R1,1.
  201.                INTsum R0,R0,R1
  202.                INTstackstore [stackregister,#24.],R0
  203.            ; ENDIF
  204. \endiflabel6
  205.         ; ENDIF
  206. \endiflabel3
  207.      ; ENDWHILE
  208.       goto \whilelabel1
  209. \endwhilelabel1
  210.  ; ENDFUNCTION    
  211. \formulafunctionend
  212.   .ENDM
  213.  
  214.  
  215. ; end of inputfile: <bubbletest$dir>.provefunc
  216.